import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
  ,
  {
    path: '/fx/product',
    name: 'fx/product',
    component: () => import('../views/fuxi/ProductListView.vue')
  },
  {
    path: '/fx/car',
    name: 'fx/car',
    component: () => import('../views/fuxi/CarListView.vue')
  }
  ,
  {
    path: '/member/login',
    name: 'member/login',
    component: () => import('../views/member/LoginView.vue')
  },
  {
    path: '/member/regist',
    name: 'member/regist',
    component: () => import('../views/member/RegisterView.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/IndexView.vue')
  },
  {
    path: '/product',
    name: 'product',
    component: () => import('../views/product/ProductListView.vue')
  },
  {
    path: '/product/detail',
    name: 'product/detail',
    component: () => import('../views/product/ProductDetailView.vue')
  },
  {
    path: '/demo/product/detail',
    name: 'demo/product/detail',
    component: () => import('../views/product/DemoPage_DetailView.vue')
  },
  {
    path: '/car/list',
    name: 'car/list',
    component: () => import('../views/car/CarListView.vue')
  },
  {
    path: '/car/orderinfo',
    name: 'car/orderinfo',
    component: () => import('../views/car/OrderInfoView.vue')
  },

]

//=============后台管理模块路由======================
/** 
 * 电商后台
 *  */
const shoppingAdminRoutes = [
  //=============后台管理的路由配置=======================
  {
    path: '/admin/index',
    name: 'admin/index',
    component: () => import('../views/admin/IndexView.vue'),
    children: [
      //==============商品================
      {
        path: '/admin/category',
        name: 'admin/category',
        component: () => import('../views/admin/shopping/product/CategoryListView.vue')
      },
      {
        path: '/admin/brand',
        name: 'admin/brand',
        component: () => import('../views/admin/shopping/product/CategoryListView.vue')
      },
      {
        path: '/admin/product',
        name: 'admin/product',
        component: () => import('../views/admin/shopping/product/ProductListView.vue')
      },
      //==============会员================
      //==============订单================
      //==============rbac================
      {
        path: '/admin/rbac/user',
        name: 'admin/rbac/user',
        component: () => import('../views/admin/rbac/UserView.vue')
      },
      {
        path: 'admin/rbac/role',
        name: 'admin/rbac/role',
        component: () => import('../views/admin/rbac/RoleView.vue')
      },
      {
        path: 'admin/rbac/menu',
        name: 'admin/rbac/menu',
        component: () => import('../views/admin/rbac/MenuView.vue')
      }
    ]
  }
]

/***
 * 复习的路由
 */
// const  fuxiRoutes=[
//   {
//     path: '/fx/product',
//     name: 'fx/product',
//     component: () => import('../views/fuxi/ProductListView.vue')
//   }
// ]

const router = new VueRouter({
  routes,shoppingAdminRoutes
})

export default router
